package com.demo.student;

import com.demo.common.model.Bookshelf;
import com.demo.common.model.Student;
import com.demo.common.model.User;
import com.jfinal.kit.Kv;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.SqlPara;

import java.util.List;

public class StudentService {

    private Student dao = new Student().dao();


    public Page<Student> paginate(int pageNumber, int pageSize) {
        return dao.paginate(pageNumber, pageSize, "select *", "from student order by id asc");
    }

    public Page<Student> paginate(int pageNumber, int pageSize, Kv cond) {
        SqlPara sqlPara = dao.getSqlPara("searchStudent",cond);
        return dao.paginate(pageNumber, pageSize, sqlPara);
    }

    public List<Student> findAll(){
        return dao.findAll();
    }

    public Student findById(int id) {
        return dao.findById(id);
    }

    public void deleteById(int id) {
        dao.deleteById(id);
    }
}
